translate

open fun translate(@NonNull target: View, leftTo: Float, topTo: Float, duration: Long, @Nullable listener: Animator.AnimatorListener)

Translates (moves) the target View to the specified screen coordinates. This method uses the animate API for a fluent animation setup. The coordinates are absolute screen positions for the view's top-left corner.

Parameters

target

The View to animate. Must not be null.

leftTo

The target x-coordinate (left position) for the view.

topTo

The target y-coordinate (top position) for the view.

duration

The duration of the animation in milliseconds. Must be non-negative.

listener

An optional AnimatorListener to receive animation lifecycle events. Can be null.

Throws

if duration is negative.